package basic01.inter;

import java.util.Scanner;

/**
 * @author Mark
 * @version 1.0
 * @date 2020/5/16 15:19
 * @description 用户交互类
 */
public class Interaction {
    public static void main(String[] args) {

        // 不换行输出
        System.out.print("输入的内容为:");
        Scanner scanner = new Scanner(System.in);

       /* if (scanner.hasNext()) {
            String nextLine = scanner.nextLine();
            System.out.println("输出的内容为:" + nextLine);
        }*/

        double sum = 0;
        int m = 0;
        while (scanner.hasNextDouble()) {
            double x = scanner.nextDouble();
            m = m + 1;
            sum = sum + x;
            System.out.println("第几个数据 = " + x + "和为 = " + sum);
        }
        System.out.println("个数和 = " + sum);
        System.out.println("平均值(sum/m) = " + (sum / m));

        // 记得关闭流
        scanner.close();
    }

}
